//
//  HCViewController.m
//  HCConsole
//
//  Created by hotacool on 12/30/2024.
//  Copyright (c) 2024 hotacool. All rights reserved.
//

#import "HCViewController.h"
#import <CocoaLumberjack/CocoaLumberjack.h>
#import <HCConsole/HCConsole.h>

DDLogLevel ddLogLevel = DDLogLevelVerbose;
@interface HCViewController ()

@end

@implementation HCViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    self.title = @"日志控制台";
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(30, 150, [UIScreen mainScreen].bounds.size.width-60, 44);
    button.backgroundColor = [UIColor blueColor];
    [button setTitle:@"显示日志工具" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(sendBehaviorLog) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
    button1.frame = CGRectOffset(button.frame, 0, 80);
    button1.backgroundColor = [UIColor blueColor];
    [button1 setTitle:@"打log11" forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(sendReportActive) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button1];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeCustom];
    button2.frame = CGRectOffset(button1.frame, 0, 80);
    button2.backgroundColor = [UIColor blueColor];
    [button2 setTitle:@"打log22" forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(sendPerformanceLog) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button2];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)sendBehaviorLog {
    if ([HCConsole sharedInstance].isShow) {
        [HCConsole hide];
    } else {
        [HCConsole show];
    }
}

- (void)sendReportActive {
    DDLogInfo(@"info: %@", NSDate.date);
}

- (void)sendPerformanceLog {
    DDLogWarn(@"warn: %@", NSDate.date);
}
@end
